package com.hdlang.assists.ad.utils

import android.graphics.Rect
import com.ven.assists.AssistsCore
import java.security.SecureRandom
import kotlin.math.abs

object RandomUtils {

    fun randomSearchContent(): String {
        val size = Constants.SEARCH_CONTENT_ARRAY.size
        val index = random(size) % size
        return Constants.SEARCH_CONTENT_ARRAY[index]
    }

    fun random(number: Int): Int {
        val secureRandom = SecureRandom()
        val secureRandomInt = secureRandom.nextInt(number)
        return secureRandomInt % number
    }

    fun getRandomX(rect: Rect): Int {
        return rect.left + random(abs(rect.left - rect.right))
    }

    fun getRandomY(rect: Rect): Int {
        return rect.top + random(abs(rect.top - rect.bottom))
    }


}